package com.example.springboot_demo.service;

import com.example.springboot_demo.mappers.mongoUserMapper;
import com.example.springboot_demo.pojo.mongoUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 江岸
 * @version V1.0
 * @ClassName: mongoUserService
 * @description: TODO
 * @date 2020/8/511:36
 * @since V1.0
 */
@Service
public class mongoUserService {
    @Autowired
    private mongoUserMapper mongoUserMapper;

    @Autowired
    private static Logger log =LoggerFactory.getLogger(mongoUserService.class);


    //添加
    public void insert(mongoUser user) {
        mongoUser insert = mongoUserMapper.insert(user);
        log.info("插入对象返回值:"+insert);
    }

    //查询所有
    public List<mongoUser> findAll(){
        List<mongoUser> all = mongoUserMapper.findAll();
        log.info("查询所有结果:"+all);
        return all;
    }
}
